<style>
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote {
    margin: 0;
    padding: 0;
}

table {
    margin: 10px 0 15px 0;
    border-collapse: collapse;
    width: 100%;
    text-align: center;
}
td,th { 
    border: 1px solid #ddd;
    padding: 3px 10px;
}
th {
    padding: 5px 10px;  
}

a {
    color: #0069d6;
}
a:hover {
    color: #0050a3;
    text-decoration: none;
}
a img {
    border: none;
}
p {
    margin-bottom: 9px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
    color: #404040;
    line-height: 36px;
}
h1 {
    margin-bottom: 18px;
    font-size: 30px;
}
h2 {
    font-size: 24px;
}
h3 {
    font-size: 18px;
}
h4 {
    font-size: 16px;
}
h5 {
    font-size: 14px;
}
h6 {
    font-size: 13px;
}
hr {
    margin: 0 0 19px;
    border: 0;
    border-bottom: 1px solid #ccc;
}
blockquote {
    padding: 13px 13px 21px 15px;
    margin-bottom: 18px;
    font-family:georgia,serif;
    font-style: italic;
}
blockquote:before {
    content:"\201C";
    font-size:40px;
    margin-left:-10px;
    font-family:georgia,serif;
    color:#eee;
}
blockquote p {
    font-size: 14px;
    font-weight: 300;
    line-height: 18px;
    margin-bottom: 0;
    font-style: italic;
}
code, pre {
    font-family: Monaco, Andale Mono, Courier New, monospace;
}
code {
    background-color: #fee9cc;
    color: rgba(0, 0, 0, 0.75);
    padding: 1px 3px;
    font-size: 12px;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
}
pre {
    display: block;
    padding: 14px;
    margin: 0 0 18px;
    line-height: 16px;
    font-size: 11px;
    border: 1px solid #d9d9d9;
    white-space: pre-wrap;
    word-wrap: break-word;
}
pre code {
    background-color: #fff;
    color:#737373;
    font-size: 11px;
    padding: 0;
}
sup {
    font-size: 0.83em;
    vertical-align: super;
    line-height: 0;
}
* {
    -webkit-print-color-adjust: exact;
}

 .layui-select-disabled .layui-disabled{
    	color:#666 !important;
    }
    .layui-disabled, .layui-disabled:hover{
    	color:#666 !important;
    }

</style>

<div class="layui-form" id="layuiadmin-form-admin" lay-filter="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
	<div class="layui-row">

		<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
	            <div class="layui-form-item">
	                <label class="layui-form-label">
	                    提交状态
	                </label>
	                <div class="layui-input-block">
	                    <input type="checkbox" lay-filter="switch" lay-skin="switch" value="{$model.status??0}" lay-text="提交|草稿箱" {notempty name="model.status" }checked{/notempty} disabled>
	                </div>
	            </div>
	        </div>
	 		<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
	            <div class="layui-form-item">
	                <label class="layui-form-label">
	                    日志类别
	                </label>
	                <div class="layui-input-block">
	                    <select id="journal_type_id" lay-verify="required" lay-filter="journal_type_id" lay-search="" disabled>
                        <option value="">请选择日志类别</option>
                        {foreach $journal_type as $key=>$vo}
                            <option value="{$vo.id}" {if condition="($model.journal_type_id eq $vo.id)" }selected{/if}>{$vo.name}</option>
                        {/foreach}
                    </select>
	                </div>
	            </div>
	        </div>
		   <div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
			            <div class="layui-form-item">
			                <label class="layui-form-label">
			                    人员名称
			                </label>
			                <div class="layui-input-block">
			                    <input autocomplete="off" class="layui-input" id="period" value="{$model.admin_name ?? ''}" placeholder="请输入人员名称" required="" type="text" readonly>
			                    </input>
			                </div>
			            </div>
			 </div>
			<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
	            <div class="layui-form-item">
	                <label class="layui-form-label">
	                    所属部门
	                </label>
	                <div class="layui-input-block">
	                    <input autocomplete="off" class="layui-input"  value="{$model.group_name ?? ''}"  placeholder="请输入所属部门" required="" type="text" readonly>
	                    </input>
	                </div>
	            </div>
	        </div>
			<div id="xinzeng"></div>
			<div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
	            <div class="layui-form-item">
	                <label class="layui-form-label">
	                    内容填写
	                </label>
	                <div class="layui-input-block">
	                     {$model.html_content | raw}
	                </div>
	            </div>
	        </div>
		   <div class="layui-form-item layui-hide">
		        <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
		    </div>
	</div>
</div>
<script src="/static/admin/layui/layui.js">
</script>

<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
        treeTable: '../admin/lib/extend/authtree'
    }).use(['index', 'form'], function () {
        var $ = layui.$, form = layui.form;

		var id = $("#journal_type_id option:selected").val();
		select_type(id);

        form.on('select(journal_type_id)',function(data){
        	select_type(data.value);
        });
        function select_type(id){
			var html = "";
        	var str = "";
        	$.ajax({
        		url:"{:url('journal/select_type')}",
        		type:"post",
        		data:{'id':id},
        		dataType: "json",
        		success:function(res){
        			var data = eval('(' + res + ')');
        			$("#xinzeng").empty();
					html+="<div class=\"layui-col-xs12 layui-col-sm6 layui-col-md4\">";
		        	html+="<div class=\"layui-form-item\">";
		        	html+="<label class=\"layui-form-label\">第x"+$("#journal_type_id option:selected").text()+"</label>";
		        	html+="<div class=\"layui-input-block\">";
		        	html+="<select  id=\"is_week\" lay-verify=\"required\" lay-filter=\"is_week\" disabled>";
		        	html+="<option value=\"\">请选择日志类别</option>";
		        	str+="<div class=\"layui-col-xs12 layui-col-sm6 layui-col-md4\">";
		        	str+="<div class=\"layui-form-item\">";
		        	str+="<label class=\"layui-form-label\">所属范围</label>";
		        	str+="<div class=\"layui-input-block\">";
		        	$.each(data,function(index, el) {
		        		if (el.detail == "{$model.is_week}") {
		        			html+="<option value=\"" + el.detail + "\" data-name=\"" + el.fanwei + "\" selected>" + el.detail + "</option>";
		        			str+="<input class=\"layui-input\" id=\"week_time\" placeholder=\"请输入所属范围\" value=\"{$model.week_time ?? ''}\" required=\"\" type=\"text\" readonly /> ";
		        		}else{
		        			html+="<option value=\"" + el.detail + "\"  data-name=\"" + el.fanwei + "\">" + el.detail + "</option>";
		        		}
		        	});
		        	html+=" </select>";
		        	html+="</div></div></div>";
		        	str+="</div></div></div>";
		        	$("#xinzeng").append(html);
		        	$("#xinzeng").append(str);
		        	form.render('select');
        		}
        	});
        }

        form.on('select(is_week)', function(event) {
        	var fanwei = $('#is_week').find("option:selected").data("name");
        	$('#week_time').val(fanwei);
        });
   });
</script>
